package wei.xinya.springAop;

import wei.xinya.springAop.dao.UserDao;
import wei.xinya.springAop.dao.UserDaoImpl;

import java.lang.reflect.Proxy;

public class Test {
    public static void main(String[] args) {
        UserDaoImpl userDao = new UserDaoImpl();
        UserDao proxyInstance = (UserDao) Proxy.newProxyInstance(Test.class.getClassLoader(),
                new Class[]{UserDao.class}, new UserDaoProxy(userDao, (int arg) -> arg > 3));
        int addResult = proxyInstance.add(4, 4);
        System.out.println(addResult);
    }
}
